﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;

namespace OpenLS.Spreadsheet
{
    class MultiRowRegion : MultiDimensionRegion<Row>
    {

        public MultiRowRegion(Row firstRow, Row lastRow)
            : base(firstRow, lastRow)
        {
        }

        protected override IEnumerable<Row> GetDimensions()
        {
            for (int i = _dim1.Index; i <= _dim2.Index; i++)
            {
                yield return _dim1.Worksheet.Rows[i];
            }
        }

public override ClusterImpact GetClusterImpact(CellClusterKey key)
        {
            if (_dim1.Index <= key.Row)
                return ClusterImpact.Full;
            if (_dim1.Index <= key.Row - CellClusterKey.Size)
                return ClusterImpact.Partial;
            return ClusterImpact.None;
        }        

    }
}